package com.itheima.config;

import com.baomidou.mybatisplus.annotation.DbType;
import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author 29143
 */
@Configuration
public class MyBatisPlusConfig {

    @Bean
    public MybatisPlusInterceptor mybatisPlusInterceptor(){
        //构建批量注册器
        MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();
        //构建分页插件对象
        PaginationInnerInterceptor paginationInnerInterceptor = new PaginationInnerInterceptor(DbType.MYSQL);
        //设置每页大小不设限
        paginationInnerInterceptor.setMaxLimit(-1L);
        //注册
        interceptor.addInnerInterceptor(paginationInnerInterceptor);
        return interceptor;
    }

}
